{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": 52,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": [
        "%matplotlib inline\n",
        "\n",
        "import pandas as pd\n",
        "import numpy as np\n",
        "import os\n",
        "from tqdm import tqdm\n",
        "import lightgbm as lgb\n",
        "from sklearn.model_selection import StratifiedKFold\n",
        "from sklearn import metrics\n",
        "import warnings\n",
        "import matplotlib.pyplot as plt\n",
        "\n",
        "pd.set_option(\u0027display.max_columns\u0027, 100)\n",
        "warnings.filterwarnings(\u0027ignore\u0027)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 97,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": [
        "def group_feature(df, key, target, aggs):   \n",
        "    agg_dict \u003d {}\n",
        "    for ag in aggs:\n",
        "        agg_dict[f\u0027{target}_{ag}\u0027] \u003d ag\n",
        "    print(agg_dict)\n",
        "    t \u003d df.groupby(key)[target].agg(agg_dict).reset_index()\n",
        "    return t\n",
        "\n",
        "def extract_feature(df, train):\n",
        "    t \u003d group_feature(df, \u0027ship\u0027,\u0027x\u0027,[\u0027max\u0027,\u0027min\u0027,\u0027mean\u0027,\u0027std\u0027,\u0027skew\u0027,\u0027sum\u0027])\n",
        "    train \u003d pd.merge(train, t, on\u003d\u0027ship\u0027, how\u003d\u0027left\u0027)\n",
        "    t \u003d group_feature(df, \u0027ship\u0027,\u0027x\u0027,[\u0027count\u0027])\n",
        "    train \u003d pd.merge(train, t, on\u003d\u0027ship\u0027, how\u003d\u0027left\u0027)\n",
        "    t \u003d group_feature(df, \u0027ship\u0027,\u0027y\u0027,[\u0027max\u0027,\u0027min\u0027,\u0027mean\u0027,\u0027std\u0027,\u0027skew\u0027,\u0027sum\u0027])\n",
        "    train \u003d pd.merge(train, t, on\u003d\u0027ship\u0027, how\u003d\u0027left\u0027)\n",
        "    t \u003d group_feature(df, \u0027ship\u0027,\u0027v\u0027,[\u0027max\u0027,\u0027min\u0027,\u0027mean\u0027,\u0027std\u0027,\u0027skew\u0027,\u0027sum\u0027])\n",
        "    train \u003d pd.merge(train, t, on\u003d\u0027ship\u0027, how\u003d\u0027left\u0027)\n",
        "    t \u003d group_feature(df, \u0027ship\u0027,\u0027d\u0027,[\u0027max\u0027,\u0027min\u0027,\u0027mean\u0027,\u0027std\u0027,\u0027skew\u0027,\u0027sum\u0027])\n",
        "    train \u003d pd.merge(train, t, on\u003d\u0027ship\u0027, how\u003d\u0027left\u0027)\n",
        "    train[\u0027x_max_x_min\u0027] \u003d train[\u0027x_max\u0027] - train[\u0027x_min\u0027]\n",
        "    train[\u0027y_max_y_min\u0027] \u003d train[\u0027y_max\u0027] - train[\u0027y_min\u0027]\n",
        "    train[\u0027y_max_x_min\u0027] \u003d train[\u0027y_max\u0027] - train[\u0027x_min\u0027]\n",
        "    train[\u0027x_max_y_min\u0027] \u003d train[\u0027x_max\u0027] - train[\u0027y_min\u0027]\n",
        "    train[\u0027slope\u0027] \u003d train[\u0027y_max_y_min\u0027] / np.where(train[\u0027x_max_x_min\u0027]\u003d\u003d0, 0.001, train[\u0027x_max_x_min\u0027])\n",
        "    train[\u0027area\u0027] \u003d train[\u0027x_max_x_min\u0027] * train[\u0027y_max_y_min\u0027]\n",
        "    \n",
        "    mode_hour \u003d df.groupby(\u0027ship\u0027)[\u0027hour\u0027].agg(lambda x:x.value_counts().index[0]).to_dict()\n",
        "    train[\u0027mode_hour\u0027] \u003d train[\u0027ship\u0027].map(mode_hour)\n",
        "    \n",
        "    t \u003d group_feature(df, \u0027ship\u0027,\u0027hour\u0027,[\u0027max\u0027,\u0027min\u0027])\n",
        "    train \u003d pd.merge(train, t, on\u003d\u0027ship\u0027, how\u003d\u0027left\u0027)\n",
        "    \n",
        "    hour_nunique \u003d df.groupby(\u0027ship\u0027)[\u0027hour\u0027].nunique().to_dict()\n",
        "    date_nunique \u003d df.groupby(\u0027ship\u0027)[\u0027date\u0027].nunique().to_dict()\n",
        "    train[\u0027hour_nunique\u0027] \u003d train[\u0027ship\u0027].map(hour_nunique)\n",
        "    train[\u0027date_nunique\u0027] \u003d train[\u0027ship\u0027].map(date_nunique)\n",
        "\n",
        "    t \u003d df.groupby(\u0027ship\u0027)[\u0027time\u0027].agg({\u0027diff_time\u0027:lambda x:np.max(x)-np.min(x)}).reset_index()\n",
        "    t[\u0027diff_day\u0027] \u003d t[\u0027diff_time\u0027].dt.days\n",
        "    t[\u0027diff_second\u0027] \u003d t[\u0027diff_time\u0027].dt.seconds\n",
        "    train \u003d pd.merge(train, t, on\u003d\u0027ship\u0027, how\u003d\u0027left\u0027)\n",
        "    return train\n",
        "\n",
        "def extract_dt(df):\n",
        "    df[\u0027time\u0027] \u003d pd.to_datetime(df[\u0027time\u0027], format\u003d\u0027%m%d %H:%M:%S\u0027)\n",
        "    # df[\u0027month\u0027] \u003d df[\u0027time\u0027].dt.month\n",
        "    # df[\u0027day\u0027] \u003d df[\u0027time\u0027].dt.day\n",
        "    df[\u0027date\u0027] \u003d df[\u0027time\u0027].dt.date\n",
        "    df[\u0027hour\u0027] \u003d df[\u0027time\u0027].dt.hour\n",
        "    # df \u003d df.drop_duplicates([\u0027ship\u0027,\u0027month\u0027])\n",
        "    df[\u0027weekday\u0027] \u003d df[\u0027time\u0027].dt.weekday\n",
        "    return df"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 70,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": [
        "train \u003d pd.read_hdf(\u0027../input/train.h5\u0027)\n",
        "# train \u003d df.drop_duplicates([\u0027ship\u0027,\u0027type\u0027])"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 71,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": [
        "test \u003d pd.read_hdf(\u0027../input/test.h5\u0027)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 72,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": [
        "train \u003d extract_dt(train)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 73,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": [
        "test \u003d extract_dt(test)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 107,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": [
        "train_label \u003d train.drop_duplicates(\u0027ship\u0027)\n",
        "test_label \u003d test.drop_duplicates(\u0027ship\u0027)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 108,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "拖网    0.623000\n",
              "围网    0.231571\n",
              "刺网    0.145429\n",
              "Name: type, dtype: float64"
            ]
          },
          "execution_count": 108,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "train_label[\u0027type\u0027].value_counts(1)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 99,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": "type_map \u003d dict(zip(train_label[\u0027type\u0027].unique(), np.arange(3)))\ntype_map_rev \u003d {v:k for k,v in type_map.items()}\ntrain_label[\u0027type\u0027] \u003d train_label[\u0027type\u0027].map(type_map)\n"
    },
    {
      "cell_type": "code",
      "execution_count": 100,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "{\u0027x_max\u0027: \u0027max\u0027, \u0027x_min\u0027: \u0027min\u0027, \u0027x_mean\u0027: \u0027mean\u0027, \u0027x_std\u0027: \u0027std\u0027, \u0027x_sum\u0027: \u0027sum\u0027}\n",
            "{\u0027x_count\u0027: \u0027count\u0027}\n",
            "{\u0027y_max\u0027: \u0027max\u0027, \u0027y_min\u0027: \u0027min\u0027, \u0027y_mean\u0027: \u0027mean\u0027, \u0027y_std\u0027: \u0027std\u0027, \u0027y_sum\u0027: \u0027sum\u0027}\n",
            "{\u0027v_max\u0027: \u0027max\u0027, \u0027v_min\u0027: \u0027min\u0027, \u0027v_mean\u0027: \u0027mean\u0027, \u0027v_std\u0027: \u0027std\u0027, \u0027v_sum\u0027: \u0027sum\u0027}\n",
            "{\u0027d_max\u0027: \u0027max\u0027, \u0027d_min\u0027: \u0027min\u0027, \u0027d_mean\u0027: \u0027mean\u0027, \u0027d_std\u0027: \u0027std\u0027, \u0027d_sum\u0027: \u0027sum\u0027}\n",
            "{\u0027hour_max\u0027: \u0027max\u0027, \u0027hour_min\u0027: \u0027min\u0027}\n"
          ]
        }
      ],
      "source": [
        "train_label \u003d extract_feature(train, train_label)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 101,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "{\u0027x_max\u0027: \u0027max\u0027, \u0027x_min\u0027: \u0027min\u0027, \u0027x_mean\u0027: \u0027mean\u0027, \u0027x_std\u0027: \u0027std\u0027, \u0027x_sum\u0027: \u0027sum\u0027}\n",
            "{\u0027x_count\u0027: \u0027count\u0027}\n",
            "{\u0027y_max\u0027: \u0027max\u0027, \u0027y_min\u0027: \u0027min\u0027, \u0027y_mean\u0027: \u0027mean\u0027, \u0027y_std\u0027: \u0027std\u0027, \u0027y_sum\u0027: \u0027sum\u0027}\n",
            "{\u0027v_max\u0027: \u0027max\u0027, \u0027v_min\u0027: \u0027min\u0027, \u0027v_mean\u0027: \u0027mean\u0027, \u0027v_std\u0027: \u0027std\u0027, \u0027v_sum\u0027: \u0027sum\u0027}\n",
            "{\u0027d_max\u0027: \u0027max\u0027, \u0027d_min\u0027: \u0027min\u0027, \u0027d_mean\u0027: \u0027mean\u0027, \u0027d_std\u0027: \u0027std\u0027, \u0027d_sum\u0027: \u0027sum\u0027}\n",
            "{\u0027hour_max\u0027: \u0027max\u0027, \u0027hour_min\u0027: \u0027min\u0027}\n"
          ]
        }
      ],
      "source": [
        "test_label \u003d extract_feature(test, test_label)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 102,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": [
        "\n",
        "features \u003d [x for x in train_label.columns if x not in [\u0027ship\u0027,\u0027type\u0027,\u0027time\u0027,\u0027diff_time\u0027,\u0027date\u0027]]\n",
        "target \u003d \u0027type\u0027"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 103,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "40 x,y,v,d,hour,weekday,x_max,x_min,x_mean,x_std,x_sum,x_count,y_max,y_min,y_mean,y_std,y_sum,v_max,v_min,v_mean,v_std,v_sum,d_max,d_min,d_mean,d_std,d_sum,x_max_x_min,y_max_y_min,y_max_x_min,x_max_y_min,slope,area,mode_hour,hour_max,hour_min,hour_nunique,date_nunique,diff_day,diff_second\n"
          ]
        }
      ],
      "source": [
        "print(len(features), \u0027,\u0027.join(features))"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 104,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": [
        "params \u003d {\n",
        "    \u0027n_estimators\u0027: 5000,\n",
        "    \u0027boosting_type\u0027: \u0027gbdt\u0027,\n",
        "    \u0027objective\u0027: \u0027multiclass\u0027,\n",
        "    \u0027num_class\u0027: 3,\n",
        "    \u0027early_stopping_rounds\u0027: 100,\n",
        "}"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 105,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Training until validation scores don\u0027t improve for 100 rounds\n",
            "[100]\ttraining\u0027s multi_logloss: 0.0828667\tvalid_1\u0027s multi_logloss: 0.269078\n",
            "[200]\ttraining\u0027s multi_logloss: 0.022058\tvalid_1\u0027s multi_logloss: 0.264574\n",
            "Early stopping, best iteration is:\n",
            "[180]\ttraining\u0027s multi_logloss: 0.0284972\tvalid_1\u0027s multi_logloss: 0.262031\n",
            "0 val f1 0.8744567161504285\n",
            "Training until validation scores don\u0027t improve for 100 rounds\n",
            "[100]\ttraining\u0027s multi_logloss: 0.085238\tvalid_1\u0027s multi_logloss: 0.274897\n",
            "[200]\ttraining\u0027s multi_logloss: 0.0222402\tvalid_1\u0027s multi_logloss: 0.272668\n",
            "Early stopping, best iteration is:\n",
            "[153]\ttraining\u0027s multi_logloss: 0.0416896\tvalid_1\u0027s multi_logloss: 0.268232\n",
            "1 val f1 0.8570390224496975\n",
            "Training until validation scores don\u0027t improve for 100 rounds\n",
            "[100]\ttraining\u0027s multi_logloss: 0.0839062\tvalid_1\u0027s multi_logloss: 0.266458\n",
            "[200]\ttraining\u0027s multi_logloss: 0.0228758\tvalid_1\u0027s multi_logloss: 0.25578\n",
            "Early stopping, best iteration is:\n",
            "[164]\ttraining\u0027s multi_logloss: 0.0363628\tvalid_1\u0027s multi_logloss: 0.254512\n",
            "2 val f1 0.8808118299909231\n",
            "Training until validation scores don\u0027t improve for 100 rounds\n",
            "[100]\ttraining\u0027s multi_logloss: 0.0845035\tvalid_1\u0027s multi_logloss: 0.272673\n",
            "[200]\ttraining\u0027s multi_logloss: 0.0225549\tvalid_1\u0027s multi_logloss: 0.277392\n",
            "Early stopping, best iteration is:\n",
            "[108]\ttraining\u0027s multi_logloss: 0.0758342\tvalid_1\u0027s multi_logloss: 0.270036\n",
            "3 val f1 0.8629486588985998\n",
            "Training until validation scores don\u0027t improve for 100 rounds\n",
            "[100]\ttraining\u0027s multi_logloss: 0.0815182\tvalid_1\u0027s multi_logloss: 0.296271\n",
            "[200]\ttraining\u0027s multi_logloss: 0.0211976\tvalid_1\u0027s multi_logloss: 0.295628\n",
            "Early stopping, best iteration is:\n",
            "[160]\ttraining\u0027s multi_logloss: 0.0357663\tvalid_1\u0027s multi_logloss: 0.290207\n",
            "4 val f1 0.8549111545740181\n"
          ]
        }
      ],
      "source": [
        "fold \u003d StratifiedKFold(n_splits\u003d5, shuffle\u003dTrue, random_state\u003d42)\n",
        "\n",
        "X \u003d train_label[features].copy()\n",
        "y \u003d train_label[target]\n",
        "models \u003d []\n",
        "pred \u003d np.zeros((len(test_label),3))\n",
        "oof \u003d np.zeros((len(X), 3))\n",
        "for index, (train_idx, val_idx) in enumerate(fold.split(X, y)):\n",
        "\n",
        "    train_set \u003d lgb.Dataset(X.iloc[train_idx], y.iloc[train_idx])\n",
        "    val_set \u003d lgb.Dataset(X.iloc[val_idx], y.iloc[val_idx])\n",
        "\n",
        "    model \u003d lgb.train(params, train_set, valid_sets\u003d[train_set, val_set], verbose_eval\u003d100)\n",
        "    models.append(model)\n",
        "    val_pred \u003d model.predict(X.iloc[val_idx])\n",
        "    oof[val_idx] \u003d val_pred\n",
        "    val_y \u003d y.iloc[val_idx]\n",
        "    val_pred \u003d np.argmax(val_pred, axis\u003d1)\n",
        "    print(index, \u0027val f1\u0027, metrics.f1_score(val_y, val_pred, average\u003d\u0027macro\u0027))\n",
        "    # 0.8695539641133697\n",
        "    # 0.8866211724839532\n",
        "\n",
        "    test_pred \u003d model.predict(test_label[features])\n",
        "    pred +\u003d test_pred/5"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 106,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "oof f1 0.8660762740409558\n"
          ]
        }
      ],
      "source": [
        "oof \u003d np.argmax(oof, axis\u003d1)\n",
        "print(\u0027oof f1\u0027, metrics.f1_score(oof, y, average\u003d\u0027macro\u0027))\n",
        "# 0.8701544575329372"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 152,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "1    0.6325\n",
            "0    0.2390\n",
            "2    0.1285\n",
            "Name: pred, dtype: float64\n"
          ]
        }
      ],
      "source": [
        "pred \u003d np.argmax(pred, axis\u003d1)\n",
        "sub \u003d test_label[[\u0027ship\u0027]]\n",
        "sub[\u0027pred\u0027] \u003d pred\n",
        "\n",
        "print(sub[\u0027pred\u0027].value_counts(1))\n",
        "sub[\u0027pred\u0027] \u003d sub[\u0027pred\u0027].map(type_map_rev)\n",
        "sub.to_csv(\u0027result.csv\u0027, index\u003dNone, header\u003dNone)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 84,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": [
        "ret \u003d []\n",
        "for index, model in enumerate(models):\n",
        "    df \u003d pd.DataFrame()\n",
        "    df[\u0027name\u0027] \u003d model.feature_name()\n",
        "    df[\u0027score\u0027] \u003d model.feature_importance()\n",
        "    df[\u0027fold\u0027] \u003d index\n",
        "    ret.append(df)\n",
        "    \n",
        "df \u003d pd.concat(ret)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 85,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": [
        "df \u003d df.groupby(\u0027name\u0027, as_index\u003dFalse)[\u0027score\u0027].mean()\n",
        "df \u003d df.sort_values([\u0027score\u0027], ascending\u003dFalse)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 86,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [
        {
          "data": {
            "text/html": [
              "\u003cdiv\u003e\n",
              "\u003cstyle scoped\u003e\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "\u003c/style\u003e\n",
              "\u003ctable border\u003d\"1\" class\u003d\"dataframe\"\u003e\n",
              "  \u003cthead\u003e\n",
              "    \u003ctr style\u003d\"text-align: right;\"\u003e\n",
              "      \u003cth\u003e\u003c/th\u003e\n",
              "      \u003cth\u003ename\u003c/th\u003e\n",
              "      \u003cth\u003escore\u003c/th\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/thead\u003e\n",
              "  \u003ctbody\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e37\u003c/th\u003e\n",
              "      \u003ctd\u003ey_max_x_min\u003c/td\u003e\n",
              "      \u003ctd\u003e676.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e36\u003c/th\u003e\n",
              "      \u003ctd\u003ey_max\u003c/td\u003e\n",
              "      \u003ctd\u003e624.6\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e31\u003c/th\u003e\n",
              "      \u003ctd\u003ex_min\u003c/td\u003e\n",
              "      \u003ctd\u003e611.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e29\u003c/th\u003e\n",
              "      \u003ctd\u003ex_max_y_min\u003c/td\u003e\n",
              "      \u003ctd\u003e568.0\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e22\u003c/th\u003e\n",
              "      \u003ctd\u003ev_std\u003c/td\u003e\n",
              "      \u003ctd\u003e535.6\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e35\u003c/th\u003e\n",
              "      \u003ctd\u003ey\u003c/td\u003e\n",
              "      \u003ctd\u003e512.0\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e25\u003c/th\u003e\n",
              "      \u003ctd\u003ex\u003c/td\u003e\n",
              "      \u003ctd\u003e458.8\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e21\u003c/th\u003e\n",
              "      \u003ctd\u003ev_skew\u003c/td\u003e\n",
              "      \u003ctd\u003e445.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e40\u003c/th\u003e\n",
              "      \u003ctd\u003ey_min\u003c/td\u003e\n",
              "      \u003ctd\u003e422.6\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e32\u003c/th\u003e\n",
              "      \u003ctd\u003ex_skew\u003c/td\u003e\n",
              "      \u003ctd\u003e419.2\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e41\u003c/th\u003e\n",
              "      \u003ctd\u003ey_skew\u003c/td\u003e\n",
              "      \u003ctd\u003e416.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e16\u003c/th\u003e\n",
              "      \u003ctd\u003eslope\u003c/td\u003e\n",
              "      \u003ctd\u003e398.2\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e27\u003c/th\u003e\n",
              "      \u003ctd\u003ex_max\u003c/td\u003e\n",
              "      \u003ctd\u003e373.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e10\u003c/th\u003e\n",
              "      \u003ctd\u003ediff_second\u003c/td\u003e\n",
              "      \u003ctd\u003e368.6\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e33\u003c/th\u003e\n",
              "      \u003ctd\u003ex_std\u003c/td\u003e\n",
              "      \u003ctd\u003e343.8\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e3\u003c/th\u003e\n",
              "      \u003ctd\u003ed_mean\u003c/td\u003e\n",
              "      \u003ctd\u003e342.2\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e17\u003c/th\u003e\n",
              "      \u003ctd\u003ev\u003c/td\u003e\n",
              "      \u003ctd\u003e341.2\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e18\u003c/th\u003e\n",
              "      \u003ctd\u003ev_max\u003c/td\u003e\n",
              "      \u003ctd\u003e338.6\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e19\u003c/th\u003e\n",
              "      \u003ctd\u003ev_mean\u003c/td\u003e\n",
              "      \u003ctd\u003e331.8\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e6\u003c/th\u003e\n",
              "      \u003ctd\u003ed_std\u003c/td\u003e\n",
              "      \u003ctd\u003e331.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e39\u003c/th\u003e\n",
              "      \u003ctd\u003ey_mean\u003c/td\u003e\n",
              "      \u003ctd\u003e320.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e30\u003c/th\u003e\n",
              "      \u003ctd\u003ex_mean\u003c/td\u003e\n",
              "      \u003ctd\u003e319.0\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e42\u003c/th\u003e\n",
              "      \u003ctd\u003ey_std\u003c/td\u003e\n",
              "      \u003ctd\u003e285.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e23\u003c/th\u003e\n",
              "      \u003ctd\u003ev_sum\u003c/td\u003e\n",
              "      \u003ctd\u003e271.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e26\u003c/th\u003e\n",
              "      \u003ctd\u003ex_count\u003c/td\u003e\n",
              "      \u003ctd\u003e265.0\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e7\u003c/th\u003e\n",
              "      \u003ctd\u003ed_sum\u003c/td\u003e\n",
              "      \u003ctd\u003e262.0\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e28\u003c/th\u003e\n",
              "      \u003ctd\u003ex_max_x_min\u003c/td\u003e\n",
              "      \u003ctd\u003e258.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e1\u003c/th\u003e\n",
              "      \u003ctd\u003ed\u003c/td\u003e\n",
              "      \u003ctd\u003e252.2\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e34\u003c/th\u003e\n",
              "      \u003ctd\u003ex_sum\u003c/td\u003e\n",
              "      \u003ctd\u003e241.8\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e5\u003c/th\u003e\n",
              "      \u003ctd\u003ed_skew\u003c/td\u003e\n",
              "      \u003ctd\u003e239.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e38\u003c/th\u003e\n",
              "      \u003ctd\u003ey_max_y_min\u003c/td\u003e\n",
              "      \u003ctd\u003e233.2\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e0\u003c/th\u003e\n",
              "      \u003ctd\u003earea\u003c/td\u003e\n",
              "      \u003ctd\u003e225.6\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e43\u003c/th\u003e\n",
              "      \u003ctd\u003ey_sum\u003c/td\u003e\n",
              "      \u003ctd\u003e204.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e15\u003c/th\u003e\n",
              "      \u003ctd\u003emode_hour\u003c/td\u003e\n",
              "      \u003ctd\u003e177.8\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e2\u003c/th\u003e\n",
              "      \u003ctd\u003ed_max\u003c/td\u003e\n",
              "      \u003ctd\u003e155.6\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e20\u003c/th\u003e\n",
              "      \u003ctd\u003ev_min\u003c/td\u003e\n",
              "      \u003ctd\u003e61.0\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e11\u003c/th\u003e\n",
              "      \u003ctd\u003ehour\u003c/td\u003e\n",
              "      \u003ctd\u003e26.0\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e8\u003c/th\u003e\n",
              "      \u003ctd\u003edate_nunique\u003c/td\u003e\n",
              "      \u003ctd\u003e25.6\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e24\u003c/th\u003e\n",
              "      \u003ctd\u003eweekday\u003c/td\u003e\n",
              "      \u003ctd\u003e23.2\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e9\u003c/th\u003e\n",
              "      \u003ctd\u003ediff_day\u003c/td\u003e\n",
              "      \u003ctd\u003e20.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e4\u003c/th\u003e\n",
              "      \u003ctd\u003ed_min\u003c/td\u003e\n",
              "      \u003ctd\u003e15.2\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e14\u003c/th\u003e\n",
              "      \u003ctd\u003ehour_nunique\u003c/td\u003e\n",
              "      \u003ctd\u003e1.4\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e13\u003c/th\u003e\n",
              "      \u003ctd\u003ehour_min\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "    \u003ctr\u003e\n",
              "      \u003cth\u003e12\u003c/th\u003e\n",
              "      \u003ctd\u003ehour_max\u003c/td\u003e\n",
              "      \u003ctd\u003e0.0\u003c/td\u003e\n",
              "    \u003c/tr\u003e\n",
              "  \u003c/tbody\u003e\n",
              "\u003c/table\u003e\n",
              "\u003c/div\u003e"
            ],
            "text/plain": [
              "            name  score\n",
              "37   y_max_x_min  676.4\n",
              "36         y_max  624.6\n",
              "31         x_min  611.4\n",
              "29   x_max_y_min  568.0\n",
              "22         v_std  535.6\n",
              "35             y  512.0\n",
              "25             x  458.8\n",
              "21        v_skew  445.4\n",
              "40         y_min  422.6\n",
              "32        x_skew  419.2\n",
              "41        y_skew  416.4\n",
              "16         slope  398.2\n",
              "27         x_max  373.4\n",
              "10   diff_second  368.6\n",
              "33         x_std  343.8\n",
              "3         d_mean  342.2\n",
              "17             v  341.2\n",
              "18         v_max  338.6\n",
              "19        v_mean  331.8\n",
              "6          d_std  331.4\n",
              "39        y_mean  320.4\n",
              "30        x_mean  319.0\n",
              "42         y_std  285.4\n",
              "23         v_sum  271.4\n",
              "26       x_count  265.0\n",
              "7          d_sum  262.0\n",
              "28   x_max_x_min  258.4\n",
              "1              d  252.2\n",
              "34         x_sum  241.8\n",
              "5         d_skew  239.4\n",
              "38   y_max_y_min  233.2\n",
              "0           area  225.6\n",
              "43         y_sum  204.4\n",
              "15     mode_hour  177.8\n",
              "2          d_max  155.6\n",
              "20         v_min   61.0\n",
              "11          hour   26.0\n",
              "8   date_nunique   25.6\n",
              "24       weekday   23.2\n",
              "9       diff_day   20.4\n",
              "4          d_min   15.2\n",
              "14  hour_nunique    1.4\n",
              "13      hour_min    0.0\n",
              "12      hour_max    0.0"
            ]
          },
          "execution_count": 86,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "df"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "pycharm": {}
      },
      "outputs": [],
      "source": []
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.7.3"
    },
    "toc": {
      "base_numbering": 1,
      "nav_menu": {},
      "number_sections": true,
      "sideBar": true,
      "skip_h1_title": false,
      "title_cell": "Table of Contents",
      "title_sidebar": "Contents",
      "toc_cell": false,
      "toc_position": {},
      "toc_section_display": true,
      "toc_window_display": false
    }
  },
  "nbformat": 4,
  "nbformat_minor": 2
}